# SymbolFilter.py
import threading


class SymbolFilter(threading.Thread):
    def __init__(self, data_queue, condition_checker, result_list):
        super().__init__()
        self.data_queue = data_queue
        self.condition_checker = condition_checker
        self.result_list = result_list

    def run(self):
        while True:
            data = self.data_queue.get()  # 从队列中获取数据
            if data is None:  # 结束标记
                self.data_queue.task_done()
                break
            if self.condition_checker.check(data['data']):  # 判断数据是否满足条件
                self.result_list.append(data['symbol'])  # 保存满足条件的数据
            self.data_queue.task_done()
